Skip to content

fix(cli): exclude scoped instructions from SWE-Pruner - #12052

Merged
marius-kilocode merged 2 commits into
mainfrom
verify-swe-pruner-agents-loading
Jul 9, 2026
Merged

fix(cli): exclude scoped instructions from SWE-Pruner#12052
marius-kilocode merged 2 commits into
mainfrom
verify-swe-pruner-agents-loading

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Directory-scoped AGENTS.md files are appended to read output before SWE-Pruner runs. Successful pruning could remove those instructions while preserving metadata that prevents them from being attached again, leaving the main agent without applicable rules.\n\nThis change separates generated instruction reminders from the prunable file body, sends only source content to the skimmer, and restores the reminders byte-for-byte afterward. Inconsistent reminder metadata fails open to the original output, while pruning metrics continue to account for every line returned to the main agent.

@marius-kilocode marius-kilocode changed the title fix(cli): preserve scoped instructions during pruning fix(cli): exclude scoped instructions from SWE-Pruner Jul 8, 2026
@marius-kilocode
marius-kilocode enabled auto-merge (squash) July 8, 2026 18:07
@kilo-code-bot

kilo-code-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Reviewed the partition() split logic against read.ts's output construction (file vs. directory branches, image/PDF branch, metadata.loaded semantics, and the includeDirectoryFiles expand path) and confirmed the body/tail split is sound: the <system-reminder> block is only ever emitted once, after </content>, and only on the single-file read path that also sets metadata.loaded. The line-numbered content construction makes the marker strings unreachable inside real file content, so the new indexOf-based partitioning won't misfire. The added test exercises the real SwePruner.sweep Effect (via Effect.provideService, not internal mocks) and verifies the skimmer never sees the appended instructions, including a CRLF line-ending edge case. Changeset is present and accurately describes the user-facing behavior. All changes are confined to packages/opencode/src/kilocode/ and packages/opencode/test/kilocode/, so no fork-hygiene concerns.

Files Reviewed (3 files)
  • .changeset/protect-swe-pruner-instructions.md
  • packages/opencode/src/kilocode/swe-pruner.ts
  • packages/opencode/test/kilocode/swe-pruner.test.ts

Reviewed by claude-sonnet-5 · Input: 40 · Output: 16.3K · Cached: 1.2M

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 61d90f1 into main Jul 9, 2026
27 checks passed
@marius-kilocode
marius-kilocode deleted the verify-swe-pruner-agents-loading branch July 9, 2026 08:50
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
* fix(cli): preserve scoped instructions during pruning

* test(cli): cover CRLF scoped instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants